package com.javarush.test.level26.lesson15.big01;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by admin on 08.04.2015.
 */
public class CurrencyManipulatorFactory {
    private static Map<String, CurrencyManipulator> map = new HashMap<>();
    private CurrencyManipulatorFactory(){}

    public static CurrencyManipulator getManipulatorByCurrencyCode(String currencyCode)
    {
        if (map.containsKey(currencyCode))
        {
            return map.get(currencyCode);
        } else
        {
            CurrencyManipulator temp = new CurrencyManipulator(currencyCode);
            map.put(currencyCode,temp);
            return temp;
        }

    }

    public static Collection getAllCurrencyManipulators(){
        return map.values();
    }


}
